package com.zlq.friends;

import android.os.Bundle;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.LinearLayout;

import java.util.ArrayList;
import java.util.List;

public class MainActivity extends AppCompatActivity {
    private SwipeRefreshLayout reshLayout;
    private RecyclerView recyclerView;
    private LinearLayoutManager layoutManager;
    private LinearLayout send_comment;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        iniData();
    }
    private void iniData(){
        reshLayout = (SwipeRefreshLayout) findViewById(R.id.friend_reshlayout);
        recyclerView = (RecyclerView) findViewById(R.id.friend_re);
        send_comment = (LinearLayout) findViewById(R.id.send_comment_layout);
        layoutManager = new LinearLayoutManager(this);
        inWidget();
    }
    private void inWidget(){
        recyclerView.setLayoutManager(layoutManager);
        recyclerView.setItemAnimator(new DefaultItemAnimator());
        recyclerView.setAdapter(new MonmentAdapter(Data(),this,send_comment));
    }
    private List<Monment> Data(){
        List<Monment> monments = new ArrayList<>();
        Monment monment ;
        for (int i=0;i<3;i++){
            monment = new Monment();
            monment.setLocation("你猜我猜你猜不猜");
            monment.setMontent("心情大好出去走走，看着美女吹吹风");
            monment.setNickName("夕月流水");
            monment.setpTime("2016-01-25");
            monments.add(monment);
        }
        return monments;
    }

}
